<?php function theme_init(){
	load_theme_textdomain('paranimage', get_template_directory() . '/languages');
}add_action ('init', 'theme_init');
?>
<?php
if ( function_exists('register_sidebars') )
	register_sidebars(2, array(
		'name'=>'Sidebar %d',
        'before_widget' => '<div id="%1$s" class="widget %2$s">',
        'after_widget' => '</div>',
        'before_title' => '<h3 class="widgettitle">',
        'after_title' => '</h3>',
    ));
?>
<?php function custom_comment($comment, $args, $depth) {
       $GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?> id="comment-<?php comment_ID( ); ?>">
<?php 
			$default_avatar = get_bloginfo('template_url').'/images/avatar.gif';
			echo get_avatar( $comment, 32, $default_avatar); ?>
<?php comment_author_link() ?> <?php _e('says', 'paranimage'); ?>:
<?php if ($comment->comment_approved == '0') : //message if comment is held for moderation ?>
<em class="comment-tips"><?php _e('Your comment is awaiting moderation', 'paranimage'); ?>.</em>
<?php endif; ?>
<br />
<small class="commentmetadata">
<?php comment_date('l, F j, Y') ?> <?php _e('at', 'paranimage'); ?> <?php comment_date('G:i') ?><?php edit_comment_link( __('Edit', 'paranimage'),' &nbsp;|&nbsp; ',''); ?></small>
<br />
	<?php comment_text() ?>
 <div class="reply">
<?php echo comment_reply_link(array('reply_text' => __('Reply', 'paranimage'), 'depth' => $depth, 'max_depth' => $args['max_depth']));  ?>
</div>
<?php } ?>
<?php function custom_pings($comment, $args, $depth) {
       $GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?> id="comment-<?php comment_ID( ); ?>">
     <?php comment_author_link() ?> - <small><?php comment_date('F j, Y') ?> <?php edit_comment_link( __('Edit', 'paranimage'),'<br /> &nbsp;|&nbsp; ',''); ?></small>
</li>
<?php } ?>
<?php function most_popular_posts($no_posts = 5, $before = '<li>', $after = '</li>', $show_pass_post = false, $duration='') {
global $wpdb;
$request = "SELECT ID, post_title, COUNT($wpdb->comments.comment_post_ID) AS 'comment_count' FROM $wpdb->posts, $wpdb->comments";
$request .= " WHERE comment_approved = '1' AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status = 'publish'";
if(!$show_pass_post) $request .= " AND post_password =''";
if($duration !="") { $request .= " AND DATE_SUB(CURDATE(),INTERVAL ".$duration." DAY) < post_date ";
}
$request .= " GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_count DESC LIMIT $no_posts";
$posts = $wpdb->get_results($request);
$output = '';
if ($posts) {
foreach ($posts as $post) {
$post_title = stripslashes($post->post_title);
$comment_count = $post->comment_count;
$permalink = get_permalink($post->ID);
$output .= $before . '<a href="' . $permalink . '" title="' . $post_title.'">' . $post_title . '</a> (' . $comment_count.')' . $after;
}
} else {
$output .= $before . "None found" . $after;
}
echo $output;
} ?>